package com.haha.community.util;

import org.apache.commons.lang3.StringUtils;
import org.springframework.util.DigestUtils;

import java.util.UUID;

public class CommunityUtil {
    //生成随机的字符串
    public static String generatrUUID(){
        return UUID.randomUUID().toString().replaceAll("-","");
    }
    //MD5进行密码加密,首先加上盐值,传入要加密的值
    public static String md5(String key){
        if(StringUtils.isBlank(key)){
            return null;
        }
        //运用工具类进行加密
        return DigestUtils.md5DigestAsHex(key.getBytes());
    }
}
